// import React from "react";
// import  ReactDOM  from "react-dom/client";
// // createBrowserRouter: 用于创建基于浏览器历史记录的路由系统
// // RouterProvider: 用于配置路由系统的组件
// import { createBrowserRouter, RouterProvider } from "react-router-dom";

// const router = createBrowserRouter([
//   // 当用户在浏览器中访问 / 路径时,渲染对应组件
//   { path: "/", element: <Home /> },
// ]);
// const root = ReactDOM.createRoot(document.getElementById("root"));
// // 使路由规则生效
// root.render(<RouterProvider router={router} />);
import { redirect, useRoutes } from "react-router-dom";
import { Suspense, lazy } from 'react'

import icon1 from '../../public/image/icon1.png'
import icon2 from '../../public/image/icon2.png'
import icon3 from '../../public/image/icon4.png'
import icon4 from '../../public/image/icon5.png'
import icon5 from '../../public/image/icon3.png'

export const homeRouter:Router1=[
    {
        path:'/home/Recommended',
        element:lazy(()=>import('../pages/home/Recommended')),
        title:'精品推荐',
        icon:icon1
    },
    {
        path:'/home/Workbench',
        element:lazy(()=>import('../pages/home/Workbench')),
        title:'工作台',
        icon:icon2
    },
    {
        path:'/home/Found',
        element:lazy(()=>import('../pages/home/Found')),
        title:'创建设计',
        icon:icon3
    },
    {
        path:'/home/Compile',
        element:lazy(()=>import('../pages/home/Compile')),
        title:'编号设置',
        icon:icon4
    },
    {
        path:'/home/Mine',
        element:lazy(()=>import('../pages/home/Mine')),
        title:'我的收藏',
        icon:icon5
    }
]


const routes = [
    {
        path:'/',
        to:'/home/Recommended'
    },
    {
        path:'/home',
        element:lazy(()=>import('../pages/Home')),
        children:homeRouter 
    },
    {
        path:'*',
        element:lazy(()=>import('../pages/Error'))
    }
]

export default routes
